1. Field of the Invention
The present invention relates to techniques for inserting additional information into discrete cosine transform (DCT) coefficient data, which is intermediate data in a digital image encoding system conforming to compression standards such as MPEG, JPEG, H.261. or the like.
2. Description of the Prior Art
With wide-spreading digital satellite broadcasting, Internet transmission and DVD (Digital Video Disk), etc. in recent years, digital images are becoming easily accessible to users. Since the quality of digital images does not deteriorate when they are copied, securing their copyrights is an important issue. As means for implementing protection for copyrights, there has been proposed a technique of adding copyright information or the like into the DCT coefficient domain of digital image (see Japanese Patent Application Unexamined Publication No. 10-178642).
A typical example of such a conventional information inserting system will be described briefly with reference to FIG. 9.
Referring to FIG. 9, an information inserting section 520 receives information to be inserted from an insertion information memory 530 and inserts the information into DCT coefficients of image data. The information is inserted with reference to a variable-length code table 510. More specifically, the variable-length code table 510 is searched for a combination of level and zero-run length (hereinafter simply referred to as xe2x80x9crun lengthxe2x80x9d), that allows the length of the code to be kept constant when the level is changed. Therefore, the information can be inserted by only changing the level of that combination.
FIG. 10 is an example of insertion of certain information into DCT coefficients of a block of image data. In this example, a one-dimensional data stream obtained by scanning the DCT coefficients in zigzag order is represented as follows:
before the information is inserted,
(15,7,5,3,0,2,0,0,0,0,0,1,2,3,0, . . .
0,0,0,1,0,0,2,0,0,0,0,0,0,0,0); and
after the information has been inserted,
(15,7,6,3,0,2,0,0,0,0,0,1,2,3,0, . . .
0,0,0,1,0,0,2,0,0,0,0,0,0,0,0).
Insertion of the information in this example is performed by changing the level of the third coefficient from 5 to 6. The code length after Huffman coding does not change before and after insertion of the information. That is, the code length of a code corresponding to a combination of run length and level (run_length=0, level=5) is 9 and that corresponding to (run_length=0, level=6) is also 9. Therefore, a change from (run_length=0, level=5) to (run_length=0, level=6) of the third coefficient does not cause any change in code length, remaining 9 bits.
Such a conventional information inserting method, however, has a problem of allowing only a limited amount of information to be inserted. This is because information is only inserted by finding a combination (run length, level) at which the code length does not vary though the level of a DCT coefficient is changed and then changing only the level of a found combination.
It is an object of the present invention to provide a system and method allowing an increased amount of information to be inserted into DCT coefficient data.
According to the present invention, a system for inserting additional information in DCT coefficients by referring to a variable-length code table, wherein the DCT coefficients are generated in blocks from image data, includes an information inserting section for inserting additional information into input DCT coefficients in a block by changing at least one DCT coefficient of the input DCT coefficients to produce changed DCT coefficients; and a total code length restoring section for correcting a level of one DCT coefficient selected from the changed DCT coefficients in the block to produce corrected DCT coefficients by referring to the variable-length code table, wherein the one DCT coefficient is selected so that a total code length of codes generated from the corrected DCT coefficients is equal to an original total code length of codes generated from the input DCT coefficients in the block.
The total code length restoring section preferably includes a difference calculator for calculating a total code length difference between the original total code length and a total code length of codes generated from the changed DCT coefficients in the block; a target code length calculator for calculating a target code length for a non-zero DCT coefficient sequentially selected from the changed DCT coefficients based on a difference between the total code length difference and a current code length of the non-zero DCT coefficient; and a level corrector for correcting a level of the non-zero DCT coefficient to produce corrected DCT coefficients when a corrected code length of a code generated from a combination of a zero-run length and a corrected level of the non-zero DCT coefficient substantially matches the target code length.
The level corrector may include a level candidate calculator for calculating a level candidate of the non-zero DCT coefficient based on a current level of the non-zero DCT coefficient; a determiner for determining whether a corrected code length of a code generated from a combination of a zero-run length and the level candidate of the non-zero DCT coefficient substantially matches the target code length; and a corrector for correcting a level of the non-zero DCT coefficient to the level candidate when the corrected code length matches the target code length. The level candidate calculator may include a level range limiter for limiting a level range of the non-zero DCT coefficient based on the current level of the non-zero DCT coefficient; and a candidate generator for generating a level candidate within the level range.
The level corrector may include a level candidate calculator for calculating a level candidate of the non-zero DCT coefficient based on the target code length and a zero-run length of the non-zero DCT coefficient; a determiner for determining whether a corrected code length of a code generated from a combination of the zero-run length and the level candidate of the non-zero DCT coefficient substantially matches the target code length; and a corrector for correcting a level of the non-zero DCT coefficient to the level candidate when the corrected code length matches the target code length. The level candidate calculator may include a candidate generator for generating a level candidate based on the target code length and a zero-run length of the non-zero DCT coefficient; a level range limiter for limiting a level range of the non-zero DCT coefficient, wherein the level range is limited by a maximum level and a minimum level; and a level selector for selecting one of the level candidate, the maximum level and the minimum level depending on whether the level candidate falls within the level range.